package com.wcx.application.controller;


import com.wcx.application.service.ChatService;
import com.wcx.application.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/chat")
@ResponseBody
public class ChatController {
    @Autowired
    private ChatService chatService;

    @GetMapping("/Chatlist")
    public Result getChatList(String fromId) {
        return Result.ok().data("list", chatService.getList(fromId));
    }

    @GetMapping("/ChatMessage")
    public Result getChatMessage(String fromId, String toId) {
        return Result.ok().data("list", chatService.getMessage(fromId, toId));
    }

    @GetMapping("/ChatMessageSearch")
    public Result getChatMessage(String fromId) {
        return Result.ok().data("list", chatService.ChatMessageSearch(fromId));
    }

    @GetMapping("/ChatMessagejianl")
    public Result getChatMessagejianl(String fromId) {
        return Result.ok().data("list", chatService.getChatMessagejianl(fromId));
    }
}